package com.mgface.eth.tool;

import org.web3j.protocol.Web3j;
import org.web3j.protocol.admin.Admin;
import org.web3j.protocol.http.HttpService;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project eth
 * @create 2018-06-27 18:17
 **/
public final class Web3JInstance {


	//账户0x70982B82D6EdFDC91B0998c62954e703B7407747

	//私钥8341e5451480e81f220610f9ada693fe7a5dcc19d28833ce0c2f4f4d7f649104
	private static final String  URL = "https://ropsten.infura.io/IY77yuopq4bSgHoaFqJe";

	//private static final String  URL = "https://rinkeby.infura.io/IY77yuopq4bSgHoaFqJe";

	private Web3JInstance(){

	}

	private static class Web3JInstanceHolder{
		private static final Web3j WEB3J = Web3j.build(new HttpService(Web3JInstance.URL));
		private static final Admin ADMIN = Admin.build(new HttpService(Web3JInstance.URL));
	}

	public static Web3j getWeb3jInstance() {
		return Web3JInstanceHolder.WEB3J;
	}

	public static Admin getAdminInstance() {
		return Web3JInstanceHolder.ADMIN;
	}
}
